﻿<%
Dim sSQLb
Dim rsb
Dim contentID
Dim allowComment
Dim categoryID
Dim categoryName
If Request.QueryString("id")<>"" Then
	contentID = Clng(Request.QueryString("id"))
else
	Response.Redirect "Default.asp"
end if
sSQLb = "Select c.*,ca.name as categoryname,f.filename from content as c inner join category as ca on c.categoryid = ca.id" & _
	   " inner join [file] as f on f.contentid = c.id where c.id = " & contentID & _
	   " and c.status =3 and c.startpublish <='"& beginTime &"' and c.endpublish >='" & endTime & "'" 
'Response.Write(sSQLb)
%>

<table class="table_body" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="left_col" valign="top">
                <!--#Include File = "Left.asp" -->
            </td>
            <td valign="top">
                <table style="border-collapse: collapse;" width="100%" border="0" cellpadding="0"
                    cellspacing="0">
                    <tbody>
                        <tr>
                            <td class="middle_col">
								<!--start new detail -->
								<%
								set rsb = DBLayer.GetRecordSet(sSQLb)
								While not rsb.EOF 
									categoryID = rsb("categoryid").Value
									categoryName = rsb("categoryname").Value
									allowComment = rsb("allowcomment").Value
									'Response.Write("allow comment " & allowComment)
								%>
								  <a class="title_cat" href="Default.asp">
                                    TRANG CHỦ</a> - <a class="title_cat" href="Default.asp?act=category&id=<%Response.Write(rsb("categoryid").Value)%>">
                                        <%Response.Write(rsb("categoryname").Value)%></a>
                                <hr>
                                <span  class="title_read_news"><%Response.Write(rsb("title").Value)%></span><span  class="date"><%Response.Write(rsb("updatetime").Value)%></span>
                                <div  class="read_news">
                                    <font face="Times New Roman" size="3">
                                        <br>
                                    </font>
                                    <div align="justify">
                                        <strong><font face="Times New Roman" size="3"><%Response.Write(rsb("description").Value)%>...</font></strong><br>
                                        <br>
										<font face="Verdana" size="2">
										<%
										sSQLk = "Select top 5 c.id, c.title, c.description,c.createtime,c.usercreate,c.categoryid,cat.name as categoryname, c.status, u.username from content as c inner join category as cat on c.categoryid = cat.id " &_
												" right join contentrelation as cr on cr.childid=c.id " & _
												" inner join [user] as u on u.id = c.usercreate Where cr.parentid = " & contentID & " and c.isdeleted =0"
										set rsk = DBLayer.GetRecordSet(sSQLk)
										While not rsk.EOF 
										%>
										
										&gt;&gt;<strong><a i class="read_more"  href="Default.asp?act=content&id=<%=rsk("id").Value%>"><%=rsk("title").Value%></a><br>
	                                        </strong>
										
										<%
										rsk.MoveNext
										Wend
										%>
										
										</font>
									
										<br>
										<%Response.Write(rsb("body").Value)%>
										
									</div>
								</div>
								
								<%
								rsb.MoveNext
								Wend
								%>
							
                                
                                <div  style="padding-top: 16px;">
                                    
                                </div>
                                <div style="width: 100%; height: auto; clear: both; margin-left: 3px; margin-bottom: 18px;
                                    margin-top: 18px;">
								<!--#Include File = "adv-main.asp" -->

                                </div>
                                <div align="right">
                                    <span class="bodytxt"><a href="print.asp?id=<%Response.Write(contentID)%>" target="window">
                                        <img alt="" src="js-css/print_icon.gif" width="32" border="0" height="18">
                                        In bài này</a> </span>
                                </div>
								
								<% if allowComment then %>
								<div>
	
        
        <div id="binhluan">
            <div class="moreNew">
                <div style="font-weight: bold; padding: 3px; border: 1px solid rgb(167, 11, 22); background: none repeat scroll 0% 0% rgb(241, 241, 241);">Các bài bình luận</div>
				<div style="color: red; font-size: 11px; padding-bottom: 10px; padding-top: 5px; font-family: Arial;">Bình
 luận do thành viên gửi, TinTheThao.com.vn không chịu trách nhiệm về nội
 dung của bạn đọc. Chúng tôi sẽ không đăng các ý kiến nhạy cảm. Mong 
thành viên thông cảm.</div>
                
                        <table width="100%">
                    
                        <tbody>
						<%
						Dim sSQLh
						Dim rsh
						sSQLh = "SELECT c.title as contenttitle, a.*, u.username FROM comment as a inner join content as c on a.contentid = c.id " & _
		"left join [user] as u on u.id =a.userapproval where a.status=1 and a.contentid = " & contentID '1=> da duyet publish
						Set rsh= DBLayer.GetRecordSet(sSQLh)
						
						While Not rsh.EOF 
						%>
						
						<tr>
                            <td class="commentTitle">
                                <b>
                                    <span>Bình luận:<%=rsh("title").Value%></span></b></td>
                        </tr>
                        <tr>
                            <td style="text-align: justify;" class="commentDetail">
                                <span><%=rsh("body").Value%></span></td>
                        </tr>
                        <tr>
                            <td align="right" class="commentName">
                                Được gửi bởi:
                                <span><%=rsh("fullname").Value%></span></td>
                        </tr>
						<%
						if rsh("showemail").Value  then
						%>
                        <tr>
                            <td align="right" class="commentName">
                                Email :<span><%=rsh("email").Value%></span></td>
                        </tr>
						<%
						end if
						%>
                        <tr>
                            <td align="right" class="commentDate">
                                Gửi lúc:
                                <span><%=rsh("createtime").Value%></span></td>
                        </tr>
                    
                        <tr>
                            <td>
                                &nbsp;</td>
                        </tr>
						
						
						<%
						
						rsh.MoveNext
						Wend
						
						%>
						
                  
                    
                        </tbody></table>
                <div style="clear: both; height: auto; width: auto; margin: 0px; padding: 0px;">
                <table align="right" class="pager">
                    <tbody>
					<tr>
                        <td style="font-size: 11px;">
                            Trang:</td>
                        <td style="font-size: 11px;">
                            <table border="0" style="height: 30px; width: 100%;">
								<tbody><tr>
									<td class="pageItemOn"><a href="#">1</a></td>
								</tr>
								</tbody>
							</table>
                        </td>
                    </tr>
					</tbody>
				</table>
                </div>
            </div>
        </div>
    
</div>
                                <iframe style="overflow: hidden;" id="xyz" src="AddComment.asp?id=<%Response.Write(contentID)%>" width="550" frameborder="0"
                                    height="450" scrolling="0"></iframe>
									
                                <hr size="1/">
								
								<%end if%>
                                <br>
                                <b>Các tin thể thao mới tổng hợp:</b>
                                <table>
                                    <tbody>
									<!--6 tin moi nhat -->
										<%
											Dim sSQLd 
											Dim rsd
										
											sSQLd = "Select top 6 c.*,ca.name as categoryname,f.filename from content as c inner join category as ca on c.categoryid = ca.id" & _
										   " inner join [file] as f on f.contentid = c.id" & _
										   " where c.id <> " & contentID & " and c.updatetime > '" & beginTime & "' and c.updatetime <'" & endTime & "'" & _
										   " and c.status =3 and c.startpublish <='"& beginTime &"' and c.endpublish >='" & endTime & "'" 
										   
											'Response.Write(sSQLd)
										
									
											set rsd = DBLayer.GetRecordSet(sSQLd)
											While Not rsd.EOF
										%>
                                        <tr>
                                            <td>
                                                <a  class="read_more" href="Default.asp?act=content&id=<%Response.Write(rsd("id").Value)%>">
                                                    <%Response.Write(rsd("title").Value)%></a><sup class="date"><%Response.Write(rsd("updatetime").Value)%></sup>
													<%
													if datevalue(CDate(rsd("updatetime").Value)) = datevalue(Cdate(now())) then
													%>									
													<img  src="js-css/icon_new1.jpg" style="border-width: 0px;"/>
													<%
													end if
													%>
                                            </td>
                                        </tr>
										<% rsd.MoveNext
											Wend
											%>
                                   
										<tr><td>&nbsp;</td></tr>
                                       
                                    </tbody>
                                </table>
                                <br>
                                <b>Các tin cũ hơn:</b>
                                <table>
                                    <tbody>
										<!--10 tin cu hon -->
										<%
											Dim sSQLe 
											Dim rse
										
											sSQLe = "Select top 10 c.*,ca.name as categoryname,f.filename from content as c inner join category as ca on c.categoryid = ca.id" & _
										   " inner join [file] as f on f.contentid = c.id" & _
										   " where c.id <> " & contentID & " and c.updatetime < '" & beginTime & "'" & _
										   " and c.status =3 and c.startpublish <='"& beginTime &"' and c.endpublish >='" & endTime & "'" 
										   
											'Response.Write(sSQLe)
										
									
											set rse = DBLayer.GetRecordSet(sSQLe)
											While Not rse.EOF
										%>
                                        <tr>
                                            <td>
                                                <a  class="read_more" href="Default.asp?act=content&id=<%Response.Write(rse("id").Value)%>">
                                                    <%Response.Write(rse("title").Value)%></a><sup class="date"><%Response.Write(rse("updatetime").Value)%></sup>
													
													<%
													if datevalue(CDate(rse("updatetime").Value)) = datevalue(Cdate(now())) then
													%>									
													<img  src="js-css/icon_new1.jpg" style="border-width: 0px;"/>
													<%
													end if
													%>
                                            </td>
                                        </tr>
										
									
										<% rse.MoveNext
											Wend
											%>
                                        
                                        
                                       
                                    </tbody>
                                </table>
                                <div align="right">
                                    <a  href="Default.asp?act=category&mode=all">
                                        Xem toàn bộ &gt;&gt;</a></div>
                            </td>
                            <td class="right_col">
								<div>
								<!--#Include File = "adv-top-right.asp" -->
								</div>
                                <div style="padding-top: 8px;">
                                </div>
                                <br>
                                <div class="box">
                                    <div style="padding: 5px; background-color: rgb(218, 218, 218); font-weight: bold;">
                                        <b>Các tin cùng chủ đề:</b></div>
										
									<%
										Dim sSQLc
										Dim rsc
										
										sSQLc = "Select top 20 c.*,ca.name as categoryname,f.filename from content as c inner join category as ca on c.categoryid = ca.id" & _
										   " inner join [file] as f on f.contentid = c.id" & _
										   " where c.id <> " & contentID & " and (c.categoryid = " & categoryID & " or ca.id in (select id from category where parentid =" & categoryID & "))"  & _
										   " and c.status =3 and c.startpublish <='"& beginTime &"' and c.endpublish >='" & endTime & "'" 
									 
										  
										'Response.Write("select sql :" & sSQLc)
	
									%>
                                    <ul style="margin: 0px; padding-left: 17px;">
										<!-- 20 tin cung chu de -->
										<%
											set rsc = DBLayer.GetRecordSet(sSQLc)
											While Not rsc.EOF
										%>

										 <li style="list-style-type: disc;"><a  title="<%Response.Write(rsc("updatetime").Value)%>" class="read_more" href="Default.asp?act=content&id=<%Response.Write(rsc("id").Value)%>">
                                            <%Response.Write(rsc("title").Value)%></a> </li>
										<%
											rsc.MoveNext
											Wend
										%>
                                       
                                      
                                       
                                     
                                    </ul>
                                    <div align="right">
										<a  href="Default.asp?act=category&id=<%Response.Write(categoryID)%>">Xem toàn bộ &gt;&gt;</a>
                                       
                                    </div>
                                </div>
                                <div style="margin-top: 10px;">
                                   
                                    <div class="ads" style="width: 300px;">
									<!--#Include File = "adv-bottom-right.asp" -->

									</div>
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </td>
        </tr>
    </tbody>
</table>
